/**
 * https://leetcode.cn/problems/array-partition-i/
 * @param nums
 */
function arrayPairSum(nums: number[]): number {
  let ans = 0

  nums.sort()

  for (let i = 0; i < nums.length; i += 2) {
      ans += nums[i]
  }

  return ans;
}
